<template>
  <transition name="fade">
    <div class="actionsheet_wrapper" v-show="open">
      <div class="actionsheet">
        <div class="_content">
          <p class="item" v-for="(item,index) in action" :key="index" @click="item.method">
            <img :src="item.img" alt="">
            <span>{{item.name}}</span>
          </p>
        </div>
        <p class="quxiao" @click="close()">取消</p>
      </div>
    </div>
  </transition>
</template>
<script>
export default {
  props:['open'],
  name: "actionsheet",
  props: {
    open: false, //接收从父组件传过来的控制是否显示的属性
    action: Array
  },
  data() {
    return {};
  },
  created() {},
  methods: {
    // cancelFunc() {
    //   this.$emit("show");
    // },
    close() {
      this.open = false;
    }
  }
};
</script>
<style>
.actionsheet_wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  width: -webkit-calc(100% - 16px);
  padding: 8px;
  background-color: #fff;
}
.actionsheet_wrapper ._content {
  text-align: center;
}
.actionsheet_wrapper > .cancel {
  background-color: #39678c;
  color: #fff;
  height: 40px;
  line-height: 40px;
  margin: 0;
}
._content {
  overflow: hidden;
}
._content > .item {
  width: 25%;
  float: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.item > span {
  width: 100%;
  display: block;
  text-align: center;
  font-size: 14px;
  margin: 10px 0;
}
.item > img {
  width: 60px;
}
.actionsheet > .quxiao {
  border-top: 1px solid #e0e0e0;
  margin-top: 5px;
  display: block;
  width: 100%;
  height: 45px;
  line-height: 45px;
  font-size: 18px;
  color: #333;
  background-color: #fff;
  text-align: center;
}
.fade-enter-active,
.fade-leave-active {
  transition: all 0.4s ease;
}

.fade-enter,
.fade-leave-to {
  transform: translate3d(0, 100%, 0);
  opacity: 0;
}
.actionsheet_wrapper > button {
  border: none;
  width: 90px;
  height: 35px;
  font-size: 14px;
  line-height: 35px;
  border-radius: 6px;
  color: #fff;
  background-color: #0894ec;
}
</style>
